﻿#ifndef DISPATCHCORE_H
#define DISPATCHCORE_H

#include <QObject>
#include <QJsonArray>
#include <QList>
#include "base/ServerMonitor.h"
#include "base/Command.h"
#include "./Manager/ServoManager.h"

class DispatchCore : public QObject
{
    Q_OBJECT
public:
    explicit DispatchCore(QObject *parent = nullptr);
    ~DispatchCore();
    void InitCommDevice();  // 初始化串口及设备控制类

    void SignalHandler( int signum );
public slots:
    void slot_ServerCommandAnalysis(QJsonObject);   // 解析上位机指令

signals:
    void sig_SetServoParam(uint8_t, int32_t , int32_t );
    void sig_moveCmd(QJsonObject);
    void sig_ReadRwParams(uint8_t);
    void sig_startInOutCabCmd();
    void sig_startQRLocateCmd();
    void sig_stopApp();
    void sig_sendDataToServer(QJsonObject);
    void sig_imgCmd();
private:
    ServerMonitor *pServerMonitor {nullptr};   // 上位机服务器侦听类指针
    QThread *pThread_ServerMonitor {nullptr};

    ServoManager *pServoManager {nullptr};
    QThread *pThread_ServoManager {nullptr};
};

#endif // DISPATCHCORE_H
